﻿@{
    ViewBag.Title = "Index";
   // Layout = "~/Views/Shared/_LayoutIndex.cshtml";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
       gridList();
    });
   function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/SystemManage/Propertymapping/GetGridJson",
            height: $(window).height() - 96,
            colModel: [
                { label: "主键", name: "id", hidden: true, key: true },
                { label: '属性名称', name: 'propertyName', width: 150, align: 'left' },
                { label: '属性值', name: 'propertyValue', width: 150, align: 'left' },
                { label: '属性含义', name: 'propertyMeaning', width: 150, align: 'left' },
                { label: '标记', name: 'remark', width: 150, align: 'left' },
                { label: '父节点', name: 'parentId', width: 150, align: 'left' }

            ],
            pager: "#gridPager",
            sortname: 'id asc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() },
               // postData: { itemId: $("#itemTree").getCurrentNode().id, keyword: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "新增数据字典",
            url: "/SystemManage/Propertymapping/Form",
            width: "550px",
            height: "570px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().id;
        $.modalOpen({
            id: "Form",
            title: "修改数据字典",
            url: "/SystemManage/Propertymapping/Form?keyValue=" + keyValue,
            width: "550px",
            height: "570px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_delete() {
        $.deleteForm({
            url: "/SystemManage/Propertymapping/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().id },
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().id;
        $.modalOpen({
            id: "Details",
            title: "查看数据字典",
            url: "/SystemManage/Propertymapping/Details?keyValue=" + keyValue,
            width: "550px",
            height: "620px",
            btn: null,
        });
    }
    function btn_copyandpaste() {
        $.deleteForm({
            url: "/SystemManage/Propertymapping/copyAndPasteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().id },
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>
    <div class="topPanel">
        <div class="search">
            <table>
                <tr>
                    <td>
                        <div class="input-group">
                            <input id="txt_keyword" type="text" class="form-control" placeholder="数据字典名称" style="width: 200px;">
                            <span class="input-group-btn">
                                <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </td>
                </tr>
            </table>
        </div>

        <div class="toolbar">
            <div class="btn-group">
                <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
            </div>
            <div class="btn-group">
                <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建数据字典</a>
            </div>
            <div class="operate">
                <ul class="nav nav-pills">@*authorize="yes"*@
                    <li class="first">已选中<span>1</span>项</li>
                    <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改数据字典</a></li>
                    <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除数据字典</a></li>
                    <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看数据字典</a></li>
                    @* <li><a id="NF-copyAndPaste" onclick="btn_copyandpaste()"><i class="fa fa-search-plus"></i>复制粘贴</a></li>*@
                </ul>
                <a href="javascript:;" class="close"></a>
            </div>
        
        </div>
        
    </div>
    
<div class="gridPanel">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>